feat(Segment membership): Refresh membership counts on segment edit#7828
Conversation
Wire the per-project segment membership count refresh into the segment create, update, clone and LaunchDarkly import paths via a new `enqueue_membership_refresh` service, so edits refresh counts within minutes instead of waiting for the daily backfill. The service debounces per project and no-ops when the feature flag is off. beep boop
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7828 +/- ##
=======================================
Coverage 98.58% 98.58%
=======================================
Files 1465 1466 +1
Lines 56889 56974 +85
=======================================
+ Hits 56082 56167 +85
Misses 807 807 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
emyller
left a comment
There was a problem hiding this comment.
I'd love to see suggested improvements to tests, though none are blocking if you need to proceed.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #7470.
In this PR, we wire the per-project segment membership count cache refresh into the segment edit paths. The daily backfill stays as the safety net for projects whose segments aren't edited.
A new
enqueue_membership_refresh(project)service queuesrefresh_project_segment_countsfor a project with a debounce to protect against rapid successive edits.It's called from each path that creates or edits a canonical segment:
SegmentSerializer.create)SegmentSerializer.update)cloneviewset action)process_import_requestcompletes)Segment deletion is left to the daily backfill, which prunes stale count rows.
How did you test this code?
Added new tests:
enqueue_membership_refreshcovering the flag gate, the per-project debounce, and that an enqueued refresh runs end to end.